<%@page import="com.situ.student.entity.Banji"%>
<%@page import="com.situ.student.entity.Student"%>
<%@page import="java.util.List"%>
<%@page import="com.situ.student.service.impl.StudentServiceImpl"%>
<%@page import="com.situ.student.service.IStudentService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<!--导入css的三个包 css、jquery、js  -->
<!--引入css-->
<link rel="stylesheet" type="text/css" href="lib/bootstrap-3.3.7-dist/css/bootstrap.css" />
<!--引入jquery-->
<script type="text/javascript" src="lib/jquery/jquery-1.11.1.js" ></script>
<!--引入js-->
<script type="text/javascript" src="lib/bootstrap-3.3.7-dist/js/bootstrap.js" ></script>
<script type="text/javascript">
	function deleteById(id){
		//点了确定返回ture
		//点击取消，返回false
		var isDel = confirm("确认删除吗？");
		if(isDel){
			location.href="<%=request.getContextPath()%>/student?method=deleteById&id=" + id;
		}
	}
</script>
</head>
<body>



	<!-- JSP脚本 -->
	<% 
		String name = "张三";
		//IStudentService service = new StudentServiceImpl();
		//List<Student> list =  service.list();
	%>
	<!-- JSP表达式：在html页面输出 -->
	<!--<%=name %>-->
	
	
	
	
	
	<!-- 标题 -->
	<%
		for(int i = 1;i <= 6;i++){
	%>		
			<h<%=i %>>>标题<%=i %><h<%=i %>>
	<% 		
		}
	%>
	
	
	
	<%
		List<Student> list = (List<Student>)request.getAttribute("list");
	%>
	<!-- 搜索 -->
	<form action="<%=request.getContextPath()%>/student?method=list" method="post">
		姓名：<input type="text" name="name"/>
			<input type="submit" value="搜索"/>
	</form>
	
	
	<!-- 添加 -->
	<a href="student_add.jsp">添加</a>
	<!-- 遍历List<Student> list -->
	<table class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<td><input type="checkbox"/></td>
			<td>ID</td>
			<td>姓名</td>
			<td>年龄</td>
			<td>性别</td>
			<td>修改</td>
			<td>删除</td>
		</tr>
	
	<% 
		for(Student student : list){
	%>	
		<tr>
			<td><input type="checkbox"/></td>
			<td><%=student.getId()%></td>
			<td><%=student.getName()%></td>
			<td><%=student.getAge()%></td>
			<td><%=student.getGender()%></td>
			
			<td><a href="<%=request.getContextPath()%>/student?method=toUpdate&id=<%=student.getId()%>">修改</a></td>
			
			<!--网页deleteStudent 的id=get到的id（鼠标选中的id）,还得到哪个方法  -->
			<td><a href="javascript:deleteById(<%=student.getId()%>)">删除</a></td>
		</tr>
	<%		
		}
	%>
	</table>
	
	<!-- 乘法表 -->
	<%
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= i; j++) {
	%>		
			<%=j%> * <%=i%> = <%=(i*j)%>&nbsp;&nbsp;&nbsp;
	 	<%		
		}
		%>
		<br/>
	<%	
	} 
	%>
</body>
</html>